package com.hello.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hello.common.log.annotation.Log;
import com.hello.common.log.enums.BusinessType;
import com.hello.common.security.annotation.RequiresPermissions;
import com.hello.system.domain.ActivityReplies;
import com.hello.system.service.IActivityRepliesService;
import com.hello.common.core.web.controller.BaseController;
import com.hello.common.core.web.domain.AjaxResult;
import com.hello.common.core.utils.poi.ExcelUtil;
import com.hello.common.core.web.page.TableDataInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 活动回复评论Controller
 * 
 * @author hello
 * @date 2025-10-29
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/activityReplies")
public class ActivityRepliesController extends BaseController
{
    private final IActivityRepliesService activityRepliesService;

    /**
     * 查询活动回复评论列表
     */
    @RequiresPermissions("system:activityReplies:list")
    @GetMapping("/list")
    public TableDataInfo list(ActivityReplies activityReplies)
    {
        startPage();
        List<ActivityReplies> list = activityRepliesService.selectActivityRepliesList(activityReplies);
        return getDataTable(list);
    }

    /**
     * 导出活动回复评论列表
     */
    @RequiresPermissions("system:activityReplies:export")
    @Log(title = "活动回复评论", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ActivityReplies activityReplies)
    {
        List<ActivityReplies> list = activityRepliesService.selectActivityRepliesList(activityReplies);
        ExcelUtil<ActivityReplies> util = new ExcelUtil<ActivityReplies>(ActivityReplies.class);
        util.exportExcel(response, list, "活动回复评论数据");
    }

    /**
     * 获取活动回复评论详细信息
     */
    @RequiresPermissions("system:activityReplies:query")
    @GetMapping(value = "/{replyId}")
    public AjaxResult getInfo(@PathVariable("replyId") Long replyId)
    {
        return success(activityRepliesService.selectActivityRepliesByReplyId(replyId));
    }

    /**
     * 新增活动回复评论
     */
    @RequiresPermissions("system:activityReplies:add")
    @Log(title = "活动回复评论", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ActivityReplies activityReplies)
    {
        return toAjax(activityRepliesService.insertActivityReplies(activityReplies));
    }

    /**
     * 修改活动回复评论
     */
    @RequiresPermissions("system:activityReplies:edit")
    @Log(title = "活动回复评论", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ActivityReplies activityReplies)
    {
        return toAjax(activityRepliesService.updateActivityReplies(activityReplies));
    }

    /**
     * 删除活动回复评论
     */
    @RequiresPermissions("system:activityReplies:remove")
    @Log(title = "活动回复评论", businessType = BusinessType.DELETE)
	@DeleteMapping("/{replyIds}")
    public AjaxResult remove(@PathVariable Long[] replyIds)
    {
        return toAjax(activityRepliesService.deleteActivityRepliesByReplyIds(replyIds));
    }
}
